package com.cs171.market.Repository;

import com.cs171.market.entity.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface CommentRepository extends JpaRepository<Comment,Integer>{

    @Query("select c.gid as gid ,count(c.positive) as commentCount, sum(c.positive) as positiveCount from Comment c group by c.gid")
    List<Map<String,Object>> cntGoodCandSumC();
}
